<?php

namespace app\common\service;

use app\common\model\AdminRecycle;
use think\facade\Request;
class Recycle
{

    /*回收数据入库*/
    public function DelAdd($Model, $del_id)
    {
        $table = $Model->Setting('table');
        $AdminRecycle = new AdminRecycle();
        $arr = $Model->where("id in(" . $del_id . ")")->select()->toArray();
        $data = [
            'table_name' => $table,
            'app' => strtolower(app('http')->getName()),
            'controller' => strtolower(Request::controller()),
            'delete_json' => json_encode($arr, JSON_UNESCAPED_UNICODE),
            'delete_ip' => Request::ip(),
            'create_time' => date('Y-m-d H:i:s'),
            'create_id' => GetToken('id'),
        ];
        $AdminRecycle->insert($data);
    }

    /*恢复数据并删除记录*/
    public function Restore()
    {

    }
}